import { GET_GOOD_DETAIL } from "../actionType"
import { getGoodDetail } from "../../data/api"
/* 
! goods_id 是传进来的  
@params:  {goods_id: 123}

*/
export const getGoodDetailAction = (params)=>{
    return (dispatch)=>{
        // * 发请求 
        getGoodDetail(params).then(res=>{
            // * 获取商品详情的数据
            dispatch({
                type:GET_GOOD_DETAIL,
                payload:{
                    ...res
                    /* 
                    {
                        message:{},
                        meta:{}
                    }
                    */
                }
            })
        })
    }
}